

<%@ page import= "com.google.gdata.client.docs.*"%>
<%@ page import= "com.google.gdata.data.docs.*"%>
<%@ page import= "com.google.gdata.data.acl.*"%>
<%@ page import= "com.google.gdata.util.*"%>
<%@ page import= "com.google.gdata.client.docs.DocsService" %>


<%@ page import= "com.google.gdata.data.BaseEntry"%>
<%@ page import= "com.google.gdata.util.AuthenticationException"%>
<%@ page import= "com.google.gdata.client.docs.DocsService"%>
<%@ page import= "com.google.gdata.util.ServiceException"%>
<%@ page import= "com.google.gdata.data.docs.DocumentListEntry"%>
<%@ page import= "com.google.gdata.data.docs.DocumentEntry"%>
<%@ page import= "com.google.gdata.data.docs.DocumentListFeed"%>
<%@ page import= "com.google.gdata.data.PlainTextConstruct"%>
<%@ page import= "com.google.gdata.client.DocumentQuery"%>
<%@ page import= "com.google.gdata.client.http.AuthSubUtil"%>
<%@ page import= "java.net.URL" %>
<%@ page import= "java.io.IOException"%>
<%@ page import= "java.net.MalformedURLException"%>
<%@ page import= "javax.servlet.http.*" %> 
<%@page  import= "java.util.List" %>

<%@ page  import= " com.google.appengine.api.users.User"%>
<%@ page  import= " com.google.appengine.api.users.UserService"%>
<%@ page  import= " com.google.appengine.api.users.UserServiceFactory"%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%
            //A linha abaixo é usada quando este for hospedado No Tomcat - Funciona muito bem.
            String requestUrl = AuthSubUtil.getRequestUrl("http://localhost:8084/webapp/lista.jsp", "http://docs.google.com/feeds/", false, true);
            //A linha abaixo é usada quando este for hospedado no GAE (Google AppEngine) - erro de autenticação.
            //String requestUrl = AuthSubUtil.getRequestUrl("http://localhost:8080/lista.jsp", "http://docs.google.com/feeds/", false, true);
            String suggestAuthorization = "<p>Este Aplicativo Precisa acessar sua Conta Google. " +
                    "Para autorizar, <a href=\"" + requestUrl + "\"> acesse sua conta</a>.</p>";
%>

<html>
    <head>
        <title>JSP Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        
        <meta name="verify-v1" content="zfoUspYD1cvwwh+wysRH5nASscL4zSVtohs3yVbHaQg=" />
    </head>
    <body>
        <h1>Teste com Google Docs</h1>
        <p>Esse aplicativo permite que vc liste seu arquivos
            armazenados no Google Docs. Pra isso você tem que ter arquivos hospedados no Google Docs.</p>
        <p><%=suggestAuthorization%></p>
        <%--
        <%
        UserService userService = UserServiceFactory.getUserService();//
        User user = userService.getCurrentUser();//
        if(user != null){
        %><p><%=user.getNickname()%></p> <%
}%> --%>
    </body>
</html>
